﻿using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using TotalFreedomKO;

namespace MvcKO.ViewModels
{
    public class BuyerSeller : BaseKoViewModel
    {
        public Account Buyer { get; set; }
        public Account Seller { get; set; }

        public List<Account> Accounts { get; set; }
    }

    public class Account : BaseKoViewModel
    {
        public string Name { get; set; }
        public decimal Credits { get; set; }
    }

    public class People : BaseKoViewModel
    {
        public List<Person> people { get; set; }

        public People()
        { 
            people = new List<Person>();
        }
    }

    public class Person
    {
        public string firstName { get; set; }
        public string lastName { get; set; }
    }

    public class MessageModel : BaseKoViewModel
    {
        public bool displayMessage { get; set; }
    }

    public class Coords
    {
        [Range(-90,90)]
        public double Latitude { get; set;}

        [Range(-180, 180)]
        public double Longitude { get; set; }
    }

    public class Location : BaseKoViewModel
    {
        [DisplayName("Name of the city")]
        [StringLength(256)]
        public string City { get; set; }

        [Required]
        public Coords Coords { get; set; }
    }   

    public class VisibilityModel: BaseKoViewModel
    {
        public string[] MyValues { get; set; }
        public bool ShouldShowMessage { get; set; }
    }

    public class TextModel : BaseKoViewModel
    {
        public string MyMessage { get; set; }
        public double Price { get; set; }        
    }

    public class HtmlModel : BaseKoViewModel
    {
        public string Details { get; set; }
    }

    public enum EncryptionType
    { 
        None = 0,
        Base64 = 1,

        [Description("Data Encryption Standard")]
        DES = 2,

        TripleDES = 3,

        [Description("Advanced Encryption Standard")]
        AES = 4
    }

    public class LoginModel: BaseKoViewModel
    {
        public string UserName { get; set; }
        public string UserPassword { get; set; }

        public EncryptionType Encryption { get; set; }
    }

    public class ProfitModel : BaseKoViewModel
    {
        public double Profit { get; set; }
    }

    public class AttrModel : BaseKoViewModel
    {
        public string ImageLocation { get; set; }
        public string ImageTitle { get; set; }
    }

    public class CellPhoneModel : BaseKoViewModel
    {
        public bool HasCellphone { get; set; }
        public string CellphoneNumber { get; set; }
    }

    public class SpamModel : BaseKoViewModel
    {
        public bool WantsSpam { get; set; }
        public string[] SpamFlavors { get; set; }
        public string SpamFlavor { get; set; }
    }

    public class Country
    {
        public string CountryName { get; set; }
        public int CountryPopulation { get; set; }
    }

    public class CountriesModel : BaseKoViewModel
    {
        public string[] AvailableCountries { get; set; }
        public string SelectedCountry { get; set; }
        public string[] SelectedCountries { get; set; }

        public Country SelectedCountry2 { get; set; }
        public List<Country> AvailableCountries2 { get; set; }
    }

    public class ComputedModel : BaseKoViewModel
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }

        [KoComputed()]
        public string FullName
        {
            get
            {
                return "return self.FirstName() + ' ' + self.LastName();";
            }
        }

        [KoComputed()]
        public string FullName2
        {
            get
            {
                return KoHelper.ComputedJavaScript<ComputedModel>(m => m.FirstName + " " + m.LastName);
            }
        }

        [KoComputed()]
        public string FullName3
        {
            get
            {
                return KoHelper.ComputedFromFile("~/Scripts/FullName.js");
            }
        }
    }

}
